<script setup lang="ts">
import { ref } from "vue";
import { formRules } from "../utils/rule";
import { ChangeProps } from "../utils/types";

const props = withDefaults(defineProps<ChangeProps>(), {
  formInline: () => ({
    id: 0,
    oldPassword: "",
    password: "",
    newPassword: ""
  })
});
import { useRole } from "../utils/hook";
const treeRef = ref();
const tableRef = ref();
const { allCustomer } = useRole(tableRef, treeRef);
const ruleFormRef = ref();
const newFormInline = ref(props.formInline);
function getRef() {
  return ruleFormRef.value;
}

defineExpose({ getRef });
</script>

<template>
  <el-form
    ref="ruleFormRef"
    :model="newFormInline"
    :rules="formRules"
    label-width="102px"
  >
    <el-form-item label="旧密码" prop="oldPassword">
      <el-input
        v-model="newFormInline.oldPassword"
        clearable
        placeholder="请输入旧密码"
      />
    </el-form-item>
    <el-form-item label="新密码" prop="password">
      <el-input
        v-model="newFormInline.password"
        clearable
        placeholder="请输入新密码"
      />
    </el-form-item>
    <el-form-item label="请确认" prop="newPassword">
      <el-input
        v-model="newFormInline.newPassword"
        clearable
        placeholder="请确认新密码"
      />
    </el-form-item>
  </el-form>
</template>
